home *** CD-ROM | disk | FTP | other *** search
- Path: news2.ios.com!usenet
- From: vlad@gramercy.ios.com (Vlastimil Adamovsky)
- Newsgroups: comp.lang.c++
- Subject: Re: C++ Gurus! Is it correct?
- Date: Sun, 04 Feb 1996 16:02:26 GMT
- Organization: Internet Online Services
- Message-ID: <4f2koo$q5a@news2.ios.com>
- References: <4eqvtg$cg5@israel-info.datasrv.co.il> <4etnju$6gn@rolaids.frco.com> <4f0n8s$a3b@news2.ios.com> <311403bf.169980736@nntp.ix.netcom.com>
- NNTP-Posting-Host: ppp-35.ts-7.hck.idt.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- miker3@ix.netcom.com (Mike Rubenstein) wrote:
-
- >vlad@gramercy.ios.com (Vlastimil Adamovsky) wrote:
- >> I don't think the virtual destructor is necessary in this specific
- >> case where you have no added data in subclasses.
-
- >Why do you think having data has anything to do with it? From draft
- >5.3.5:
-
- > In the first alternative (delete object), if the static type
- > of the operand is different from its dynamic type, the static
- > type shall be a base class of the operand's dynamic type
- > and the static type shall have a virtual destructor or the
- > behavior is undefined.
-
-
- I prefer slightly more simple explanation as follows:
- (The Design and Evolution of C++, chapter 10.5 page 216)
- ....
- Had a virtual destructor not been used, the cleanup specified in
- Y's (in our case class B) destructor would not have been performed.
-
-
- Here you see you have choice to use virtual destructor or not.
-
- *******************************************
- * Vlastimil Adamovsky *
- * Smalltalk, C++ and Envelop development *
- *******************************************
-
-